﻿<Editor IsEditor="true" OnClickButton="@PluginClick" CustomerToolbarButtons="@EditorPluginItems"></Editor>

@code{
    private List<EditorToolbarButton> EditorPluginItems = new List<EditorPluginItem>()
    {
        new EditorPluginItem()
        {
            IconClass = "fa fa-pencil",
            PluginItemName = "plugin1",
            Tooltip = "这是 plugin1 的提示"
        },
        new EditorPluginItem()
        {
            IconClass = "fa fa-home",
            PluginItemName = "plugin2",
            Tooltip = "这是 plugin2 提示"
        }
    };

    private async Task<string> PluginClick(string pluginItemName)
    {
        var ret = "";
        if (pluginItemName == "plugin1")
        {
            var op = new SwalOption()
            {
                Title = "点击plugin1按钮后弹窗",
                Content = "点击插件按钮后弹窗并确认后才进行下一步处理",
                IsConfirm = true
            };
            await SwalService.ShowModal(op);
            ret = "从plugin1返回的数据";
        }
        if (pluginItemName == "plugin2")
        {
            var op = new SwalOption()
            {
                Title = "点击plugin2按钮后弹窗",
                Content = "点击插件按钮后弹窗并确认后才进行下一步处理",
                IsConfirm = true
            };
            await SwalService.ShowModal(op);
            ret = "从plugin2返回的数据";
        }
        return ret;
    }
}
